package org.example.v3.action;

import org.example.v3.OrderStateFactory;
import org.example.v3.OrderStateMachine;

/**
 * PendingStateAction 类表示订单的待处理状态。
 */
public class PendingStateAction implements StateAction<OrderStateMachine, String> {
    @Override
    public void handle(OrderStateMachine context, String event) {
        if (event.equals("pay")) {
            context.setStateAction(OrderStateFactory.getState("paid"));
            System.out.println("订单已支付。");
        } else {
            System.out.println("当前状态下的无效事件。");
        }
    }
}